package com.company.cloud.common.mq.redis.client.message;

import java.util.HashMap;
import java.util.Map;

import com.company.cloud.common.mq.redis.client.constant.RedisMQConstant;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class RedisMQMessage {

	private String id; // 消息ID,
	private String topic; // 消息主题
	private Map<String, String> data; // 消息数据

	public RedisMQMessage(String topic, Map<String, String> data) {
		this.topic = topic;
		this.data = data;
	}
	
	public RedisMQMessage(String topic, String data) {
		this.topic = topic;
		this.data = new HashMap<String, String>();
		this.data.put(RedisMQConstant.Msg_Content_Key, data);
	}

	public RedisMQMessage(String topic) {
		this.topic = topic;
	}

	public RedisMQMessage() {

	}

	public void addData(String key, String value) {
		if (this.data == null) {
			this.data = new HashMap<String, String>();
		}
		this.data.put(key, value);
	}
	
	public void setContent(String content) {
		this.addData(RedisMQConstant.Msg_Content_Key, content);
	}
	
	

	@Override
	public String toString() {
		return super.toString();
	}

}
